package com.duoduo.selenium.demo;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import com.duoduo.selenium.util.SeleniumUtil;

public class RegEmail {

	public static void main(String[] argus) {
		// regEmail_old();

		loginEmail();
	}

	public static void regEmail_old() {
		SeleniumUtil.setProperties();

		WebDriver driver = new FirefoxDriver();
		driver.get("http://email.163.com/");

		// driver.findElement(By.cssSelector("label#idPlaceholder")).clear();
		// driver.findElement(By.id("idPlaceholder")).click();

		// driver.findElement(By.xpath("input[@id='userNameIpt']")).sendKeys("ruibo.zhong");
		driver.findElement(By.xpath("//input[@id='userNameIpt']")).sendKeys("ruibo.zhong");

		// driver.findElement(By.cssSelector("div>label#pwdPlaceholder.placeholder")).clear();
		// driver.findElement(By.id("pwdPlaceholder")).click();

		driver.findElement(By.name("password")).sendKeys("zrb62432476bbmm");

		// driver.findElement(By.className("btn btn-login")).click();
		driver.findElement(By.cssSelector("button.btn.btn-login")).click();
		driver.close();
	}

	public static void loginEmail() {
		SeleniumUtil.setProperties();

		WebDriver driver = new FirefoxDriver();
		driver.get("http://email.163.com/");
		driver.findElement(By.id("userNameIpt")).clear();
		driver.findElement(By.id("userNameIpt")).sendKeys("ruibo.zhong");
		driver.findElement(By.id("pwdInput")).clear();
		driver.findElement(By.id("pwdInput")).sendKeys("zrb62432476bbmm");
		driver.findElement(By.id("btnSubmit")).click();
		driver.close();
	}
}
